package com.example.shop.service.impl;

import com.example.shop.entity.Invertory;
import com.example.shop.dao.InvertoryMapper;
import com.example.shop.service.InvertoryService;
import org.springframework.stereotype.Service;
import jakarta.annotation.Resource;

import java.util.List;

/**
 * (Invertory)表服务实现类
 *
 * @author makejava
 * @since 2025-03-26 09:25:25
 */
@Service("invertoryService")
public class InvertoryServiceImpl implements InvertoryService {
    @Resource
    private InvertoryMapper invertoryMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param invertoryid 主键
     * @return 实例对象
     */
    @Override
    public Invertory queryById(Integer invertoryid) {
        return this.invertoryMapper.queryById(invertoryid);
    }


    /**
     * 新增数据
     *
     * @param invertory 实例对象
     * @return 实例对象
     */
    @Override
    public Invertory insert(Invertory invertory) {
        this.invertoryMapper.insert(invertory);
        return invertory;
    }

    /**
     * 修改数据
     *
     * @param invertory 实例对象
     * @return 实例对象
     */
    @Override
    public Invertory update(Invertory invertory) {
        this.invertoryMapper.update(invertory);
        return this.queryById(invertory.getInvertoryid());
    }

    /**
     * 通过主键删除数据
     *
     * @param invertoryid 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer invertoryid) {
        return this.invertoryMapper.deleteById(invertoryid) > 0;
    }

    @Override
    public List<Invertory> queryAll() {
        return null;
    }
}
